﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Oracle;
using System.Data.Common;

namespace GgCarControl
{
    public partial class ZYJH_ST : DockContent
    {
        public ZYJH_ST()
        {
            InitializeComponent();
        }
        public static Database db =
             new OracleDatabase("Data Source=DG;User ID=dgrfid;Password=dgrfid;Unicode=True;Load Balance Timeout=1000");
        private void ZYJH_ST_Load(object sender, EventArgs e)
        {

        }

        private void btn_st_zyjh_query_Click(object sender, EventArgs e)
        {
            string date_time_val = this.dateTimePicker1.Value.ToString();
            int ind = date_time_val.IndexOf(" ");
            string date_value = date_time_val.Substring(0, ind);
            //string date_value = date_time_val..Split(" ")[0].ToString();
            string sql = "select PLANDATE as 计划时间 ,STACKNAME as 垛名,CARGONAME as 货名,SHIPNAME as 船名,SHIPPER_NAME as 货主,PIECES as 件数,YARD as 库场,REMARK as 规格"
                +" from truckplan where plandate=to_date('" + date_value + "','yyyy-mm-dd') and ioyardid=0";
            DataTable dt = db.ExecuteDataSet(db.GetSqlStringCommand(sql.ToString())).Tables[0];
            //DataTable dt = BusinessClass.GetQJZBWZ(_ym);
            this.dataGridView1.AutoGenerateColumns = true;
            this.dataGridView1.DataSource = dt;
        }
    }
}
